template-matching model